1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module sourceview.CompletionProviderIF;
26 
27 private import gio.AsyncResultIF;
28 private import gio.Cancellable;
29 private import gio.ListModelIF;
30 private import glib.ErrorG;
31 private import glib.GException;
32 private import glib.PtrArray;
33 private import glib.Str;
34 private import glib.c.functions;
35 private import gobject.ObjectG;
36 private import gtk.TextIter;
37 private import sourceview.CompletionCell;
38 private import sourceview.CompletionContext;
39 private import sourceview.CompletionProposalIF;
40 private import sourceview.c.functions;
41 public  import sourceview.c.types;
42 
43 
44 /**
45  * Completion provider interface.
46  * 
47  * You must implement this interface to provide proposals to [class@Completion].
48  * 
49  * In most cases, implementations of this interface will want to use
50  * [vfunc@CompletionProvider.populate_async] to asynchronously populate the results
51  * to avoid blocking the main loop.
52  */
53 public interface CompletionProviderIF{
54 	/** Get the main Gtk struct */
55 	public GtkSourceCompletionProvider* getCompletionProviderStruct(bool transferOwnership = false);
56 
57 	/** the main Gtk struct as a void* */
58 	protected void* getStruct();
59 
60 
61 	/** */
62 	public static GType getType()
63 	{
64 		return gtk_source_completion_provider_get_type();
65 	}
66 
67 	/**
68 	 * This function requests @proposal to be activated by the
69 	 * #GtkSourceCompletionProvider.
70 	 *
71 	 * What the provider does to activate the proposal is specific to that
72 	 * provider. Many providers may choose to insert a #GtkSourceSnippet with
73 	 * edit points the user may cycle through.
74 	 *
75 	 * See also: [class@Snippet], [class@SnippetChunk], [method@View.push_snippet]
76 	 *
77 	 * Params:
78 	 *     context = a #GtkSourceCompletionContext
79 	 *     proposal = a #GtkSourceCompletionProposal
80 	 */
81 	public void activate(CompletionContext context, CompletionProposalIF proposal);
82 
83 	/**
84 	 * This function requests that the #GtkSourceCompletionProvider prepares
85 	 * @cell to display the contents of @proposal.
86 	 *
87 	 * Based on @cells column type, you may want to display different information.
88 	 *
89 	 * This allows for columns of information among completion proposals
90 	 * resulting in better alignment of similar content (icons, return types,
91 	 * method names, and parameter lists).
92 	 *
93 	 * Params:
94 	 *     context = a #GtkSourceCompletionContext
95 	 *     proposal = a #GtkSourceCompletionProposal
96 	 *     cell = a #GtkSourceCompletionCell
97 	 */
98 	public void display(CompletionContext context, CompletionProposalIF proposal, CompletionCell cell);
99 
100 	/**
101 	 * This function should return the priority of @self in @context.
102 	 *
103 	 * The priority is used to sort groups of completion proposals by
104 	 * provider so that higher priority providers results are shown
105 	 * above lower priority providers.
106 	 *
107 	 * Lower value indicates higher priority.
108 	 *
109 	 * Params:
110 	 *     context = a #GtkSourceCompletionContext
111 	 */
112 	public int getPriority(CompletionContext context);
113 
114 	/**
115 	 * Gets the title of the completion provider, if any.
116 	 *
117 	 * Currently, titles are not displayed in the completion results, but may be
118 	 * at some point in the future when non-%NULL.
119 	 *
120 	 * Returns: a title for the provider or %NULL
121 	 */
122 	public string getTitle();
123 
124 	/**
125 	 * This function is used to determine of a character inserted into the text
126 	 * editor should cause a new completion request to be triggered.
127 	 *
128 	 * An example would be period '.' which might indicate that the user wants
129 	 * to complete method or field names of an object.
130 	 *
131 	 * Params:
132 	 *     iter = a #GtkTextIter
133 	 *     ch = a #gunichar of the character inserted
134 	 */
135 	public bool isTrigger(TextIter iter, dchar ch);
136 
137 	/**
138 	 * This function is used to determine if a key typed by the user should
139 	 * activate @proposal (resulting in committing the text to the editor).
140 	 *
141 	 * This is useful when using languages where convention may lead to less
142 	 * typing by the user. One example may be the use of "." or "-" to expand
143 	 * a field access in the C programming language.
144 	 *
145 	 * Params:
146 	 *     context = a #GtkSourceCompletionContext
147 	 *     proposal = a #GtkSourceCompletionProposal
148 	 *     keyval = a keyval such as [const@Gdk.KEY_period]
149 	 *     state = a #GdkModifierType or 0
150 	 */
151 	public bool keyActivates(CompletionContext context, CompletionProposalIF proposal, uint keyval, GdkModifierType state);
152 
153 	/**
154 	 * Providers should return a list of alternates to @proposal or %NULL if
155 	 * there are no alternates available.
156 	 *
157 	 * This can be used by the completion view to allow the user to move laterally
158 	 * through similar proposals, such as overrides of methods by the same name.
159 	 *
160 	 * Params:
161 	 *     context = a #GtkSourceCompletionContext
162 	 *     proposal = a #GtkSourceCompletionProposal
163 	 *
164 	 * Returns: a #GPtrArray of #GtkSourceCompletionProposal or %NULL.
165 	 */
166 	public PtrArray listAlternates(CompletionContext context, CompletionProposalIF proposal);
167 
168 	/**
169 	 * Asynchronously requests that the provider populates the completion
170 	 * results for @context.
171 	 *
172 	 * For providers that would like to populate a [iface@Gio.ListModel] while those
173 	 * results are displayed to the user,
174 	 * [method@CompletionContext.set_proposals_for_provider] may be used
175 	 * to reduce latency until the user sees results.
176 	 *
177 	 * Params:
178 	 *     context = a #GtkSourceCompletionContext
179 	 *     cancellable = a #GCancellable or %NULL
180 	 *     callback = a callback to execute upon completion
181 	 *     userData = closure data for @callback
182 	 */
183 	public void populateAsync(CompletionContext context, Cancellable cancellable, GAsyncReadyCallback callback, void* userData);
184 
185 	/**
186 	 * Completes an asynchronous operation to populate a completion provider.
187 	 *
188 	 * Params:
189 	 *     result = a #GAsyncResult provided to callback
190 	 *
191 	 * Returns: a #GListModel of #GtkSourceCompletionProposal
192 	 *
193 	 * Throws: GException on failure.
194 	 */
195 	public ListModelIF populateFinish(AsyncResultIF result);
196 
197 	/**
198 	 * This function can be used to filter results previously provided to
199 	 * the [class@CompletionContext] by the #GtkSourceCompletionProvider.
200 	 *
201 	 * This can happen as the user types additional text onto the word so
202 	 * that previously matched items may be removed from the list instead of
203 	 * generating new [iface@Gio.ListModel] of results.
204 	 *
205 	 * Params:
206 	 *     context = a #GtkSourceCompletionContext
207 	 *     model = a #GListModel
208 	 */
209 	public void refilter(CompletionContext context, ListModelIF model);
210 }